﻿using System.ComponentModel;
using System.Diagnostics;

namespace VMDS.Business.Processes
{
   public static  class Logger
    {
        public static void WriteLog(string msg,bool error=false,bool serv=false)
        {
            string sSource;
            string sLog;
            string sEvent;

            sSource = "VMDS_Client";
            if (serv) sSource = "VMDS_Server";
            sLog = "Application";
            sEvent = "Sample Event";
            try
            {
                if (!EventLog.SourceExists(sSource))
                    EventLog.CreateEventSource(sSource, sLog);

                if (!error) EventLog.WriteEntry(sSource, msg);
                else EventLog.WriteEntry(sSource, msg, EventLogEntryType.Error);
            }
            catch (Win32Exception)
            {
                new EventLog("Application").Clear();
            }
            


        }
    }
}
